<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 独一无二的出现次数 -->
    <script>
      var uniqueOccurrences = function (arr) {
        var map = new Map()
        arr.forEach(element => {
          if (map.get(element)) {
            var num = map.get(element)
            num++
            map.set(element, num)
          } else {
            map.set(element, 1)
          }
        })
        return new Set(map.values()).size == map.size
      }
      console.log(uniqueOccurrences([1, 2, 2, 1, 1, 3]))
    </script>
  </body>
</html>
